🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / data / src / commonMain / kotlin / org / meshtastic / core / data / datasource / EventFirmwareEditionLocalDataSource.kt
Displaying Raw • Download
core/data/src/commonMain/kotlin/org/meshtastic/core/data/datasource/EventFirmwareEditionLocalDataSource.kt 83ed71d452ee7bd23a1ebbfe0f6d42b913fe6ae7 (83ed71d4) Text, 2.22 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.data.datasource
Tff7b72import T7ee787kotlinx.coroutines.withContext
Tff7b72import T7ee787org.koin.core.annotation.Single
Tff7b72import T7ee787org.meshtastic.core.database.DatabaseProvider
Tff7b72import T7ee787org.meshtastic.core.database.entity.EventFirmwareEditionEntity
Tff7b72import T7ee787org.meshtastic.core.di.CoroutineDispatchers
Tf0883e@Single
Tff7b72class T56d364EventFirmwareEditionLocalDataSourceTb4b4b4(
Tff7b72private Tff7b72val Te6edf3dbManagerTb4b4b4: Te6edf3DatabaseProviderTb4b4b4,
Tff7b72private Tff7b72val Te6edf3dispatchersTb4b4b4: Te6edf3CoroutineDispatchersTb4b4b4,
Tb4b4b4) Tb4b4b4{
T8b949e// Reads may use the direct accessor; writes go through withDb so they register with the cross-transport merge
T8b949e// drain barrier (see DatabaseProvider).
Tff7b72private Tff7b72val Te6edf3dao
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3dbManagerTb4b4b4.Te6edf3currentDbTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3eventFirmwareEditionDaoTb4b4b4(Tb4b4b4)
Tff7b72suspend Tff7b72fun Td2a8ffgetByEditionTb4b4b4(Te6edf3editionTb4b4b4: Tffa657StringTb4b4b4)Tb4b4b4: Te6edf3EventFirmwareEditionEntity? Tff7b72=
Te6edf3withContextTb4b4b4(Te6edf3dispatchersTb4b4b4.Te6edf3ioTb4b4b4) Tb4b4b4{ Te6edf3daoTb4b4b4.Te6edf3getByEditionTb4b4b4(Te6edf3editionTb4b4b4) Tb4b4b4}
Tff7b72suspend Tff7b72fun Td2a8ffupsertAllTb4b4b4(Te6edf3editionsTb4b4b4: Te6edf3ListTff7b72<Te6edf3EventFirmwareEditionEntityTff7b72>Tb4b4b4) Tb4b4b4{
Te6edf3withContextTb4b4b4(Te6edf3dispatchersTb4b4b4.Te6edf3ioTb4b4b4) Tb4b4b4{ Te6edf3dbManagerTb4b4b4.Te6edf3withDb Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3eventFirmwareEditionDaoTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3upsertAllTb4b4b4(Te6edf3editionsTb4b4b4) Tb4b4b4} Tb4b4b4}
Tb4b4b4}
T8b949e// No-op on empty: `NOT IN ()` is always true in SQLite, so forwarding an empty list would wipe the whole table.
T8b949e// Callers only prune against a non-empty upstream payload; an empty list means "keep everything".
Tff7b72suspend Tff7b72fun Td2a8ffdeleteNotInTb4b4b4(Te6edf3keepTb4b4b4: Te6edf3ListTff7b72<Tffa657StringTff7b72>Tb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3keepTb4b4b4.Te6edf3isEmptyTb4b4b4(Tb4b4b4)Tb4b4b4) Tff7b72return
Te6edf3withContextTb4b4b4(Te6edf3dispatchersTb4b4b4.Te6edf3ioTb4b4b4) Tb4b4b4{ Te6edf3dbManagerTb4b4b4.Te6edf3withDb Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3eventFirmwareEditionDaoTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3deleteNotInTb4b4b4(Te6edf3keepTb4b4b4) Tb4b4b4} Tb4b4b4}
Tb4b4b4}
Tff7b72suspend Tff7b72fun Td2a8ffcountTb4b4b4(Tb4b4b4)Tb4b4b4: Tffa657Int Tff7b72= Te6edf3withContextTb4b4b4(Te6edf3dispatchersTb4b4b4.Te6edf3ioTb4b4b4) Tb4b4b4{ Te6edf3daoTb4b4b4.Te6edf3countTb4b4b4(Tb4b4b4) Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.05s